
#ifndef LX_COMMANDS_H
#define LX_COMMANDS_H

#include <qobject.h>

#include "LX_Define.h"
#include "LX_Map.h"
#include "LX_String.h"


#define LX_COMMANDS LX_Commands::Instance()

/**
 * Class which holds all commands for the command line. This 
 * is separated in this module to alow the use of different
 * languages for the gui and the command interface.
 * Implemented as singleton. 
 *
 * @author Stephen Hawking
 */
class LX_EXPORT LX_Commands : public QObject {
    Q_OBJECT

public:
    /**
     * @return Instance to the unique commands object.
     */
    static LX_Commands* Instance() {
        if (m_pUniqueInstance==NULL) {
            m_pUniqueInstance = new LX_Commands();
        }
        return m_pUniqueInstance;
    }

	LX_StringList Complete(const LX_String& cmd);
    LX_BaseType::ActionType CmdToAction(const LX_String& cmd);
    LX_BaseType::ActionType KeycodeToAction(const LX_String& code);

    static LX_String Command(const LX_String& cmd);

    static bool CheckCommand(const LX_String& cmd, const LX_String& str,
                             LX_BaseType::ActionType action=LX_BaseType::ActionNone);

	static LX_String MsgAvailableCommands();

protected:
    static LX_Commands* m_pUniqueInstance;

private:
	LX_Commands();
	LX_Map<LX_String, LX_BaseType::ActionType*> m_MainCommandMap;
	LX_Map<LX_String, LX_BaseType::ActionType*> m_ShortCommandMap;
};

#endif

